package com.huangfuyi.home.enums;

import com.huangfuyi.home.exceptions.EHomeException;
import com.huangfuyi.home.exceptions.ServiceException;

import java.util.HashMap;
import java.util.Map;

public class ExceptionCodes {

    private static final Map<Class<? extends EHomeException>, Integer> CODES = new HashMap<>();

    static {
        // Home子项目最高父类异常类型
        CODES.put(EHomeException.class, 500001000);
        // Service异常
        CODES.put(ServiceException.class, 500001001);
    }

    public static int getCode(Class<?> clazz) {
        return CODES.getOrDefault(clazz, 500001000);
    }
}
